<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>08-flex子项flex份数</title>
  <style>
    section {
      display: flex;
      width: 60%;
      height: 150px;
      margin: 0 auto;
      background-color: pink;
    }

    section div:nth-child(1) {
      width: 100px;
      height: 150px;
      background: purple;
    }

    /* 左右都是固定宽度与固定高度，中间内容实现自适应 */
    section div:nth-child(2) {
      /* 左右把自己该占的位置已经占掉了，将剩余空间分为一份给中间的盒子  */
      flex: 1;
      background-color: cadetblue;
    }

    section div:nth-child(3) {
      width: 100px;
      height: 150px;
      background: purple;
    }


    p {
      display: flex;
      width: 60%;
      height: 150px;
      margin: 200px auto;
      background-color: pink;
    }

    p span {
      /* 一共三个盒子每个span分一份 均等分 */
      flex: 1;
    }

    p span:nth-child(2) {
      /* 将盒子分为4份 第二个span标签吃两份 */
      flex: 2;
      background-color: powderblue;
    }
  </style>
</head>

<body>

  <section>
    <div>1</div>
    <div>2</div>
    <div>3</div>
  </section>

  <p>
    <span>1</span>
    <span>2</span>
    <span>3</span>
  </p>

</body>

</html>